# 指定CMake编译最低要求版本
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)

CMAKE_POLICY (SET CMP0048 NEW)
# 给项目命名
PROJECT(util_gtest)

# 收集c/c++文件并赋值给变量SRC_LIST_CPP  ${PROJECT_SOURCE_DIR}代表区当前项目录
FILE(GLOB SRC_LIST_CPP ${PROJECT_SOURCE_DIR}/src/*.cpp)
FILE(GLOB SRC_LIST_CC ${PROJECT_SOURCE_DIR}/src/*.cc)
# 指定头文件目录
 INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/googletest/googletest/include/gtest)
 INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/googletest/googletest/include)
# 指定生成库文件的目录
# SET(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
# 取变量SRC_LIST_CPP 与 SRC_LIST_C的值
# 指定生成libmyprint 动态库（默认为静态库）
# SHARED指定生成库类型为动态库 STATIC为静态库
# ADD_LIBRARY(myprint SHARED ${SRC_LIST_CPP} ${SRC_LIST_C})

add_subdirectory(googletest)

add_executable(${PROJECT_NAME} ${SRC_LIST_CPP} ${SRC_LIST_CC})

# target_link_directories(myprint PRIVATE ${PROJECT_SOURCE_DIR}/googletest/build/lib)
target_link_libraries(${PROJECT_NAME} gmock gtest pthread)
